package cn.itcast.consumer.client;

import cn.itcast.consumer.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
//使用了动态代理
//注入服务名 通过Eureka找到服务名，均衡负载得到service，向user/{id}地址发出请求，传递id作为参数，转换为User
@FeignClient(value = "user-service",fallback = UserClientFallback.class)//Feign的熔断功能
public interface UserClient {

    @GetMapping("/user/{id}")
    public User queryById(@PathVariable("id") long id);
}
